package com.seveneight.baijiesteward.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.bean.CardBean;
import com.seveneight.baijiesteward.bean.CreditBean;
import com.seveneight.baijiesteward.http.HttpConfig;
import com.seveneight.baijiesteward.utils.GlideLoader;
import com.seveneight.baijiesteward.utils.NumberUtil;
import com.seveneight.baijiesteward.utils.StringFormat;

/**
 * Created by user1 on 2018/3/28.
 */

public class CreditAdapter extends ListBaseAdapter<CreditBean> {

    public CreditAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_card;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        ImageView iv_bankImg = holder.getView(R.id.iv_bankImg);
        TextView tv_bankName = holder.getView(R.id.tv_bankName);
        TextView tv_cardType = holder.getView(R.id.tv_cardType);
        TextView tv_cardNum = holder.getView(R.id.tv_cardNum);
        ImageView iv_more = holder.getView(R.id.iv_more);
        final CreditBean creditBean = mDataList.get(position);
        iv_more.setVisibility(View.GONE);
        tv_cardType.setText("信用卡");
        tv_bankName.setText(creditBean.getBankName());
        tv_cardNum.setText(StringFormat.getCardNumber(creditBean.getCreditCardNo()));
        GlideLoader.displayImg(mContext, HttpConfig.SOURCE_URL + creditBean.getIcoUrl(), iv_bankImg);
    }
}
